package com.edu.exam.enums.examination;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 监控配置范围枚举
 *
 * <p>定义安全监控配置的应用范围，包括全局、模块、会话、用户等不同级别。</p>
 *
 * @author System
 * @version 1.0.0
 * @since 2025-11-14
 */
public enum MonitoringConfigScope implements BaseEnum {

    /** 全局 */
    GLOBAL("GLOBAL", "全局", "适用于整个系统的全局配置"),

    /** 模块 */
    MODULE("MODULE", "模块", "适用于特定模块的配置"),

    /** 会话 */
    SESSION("SESSION", "会话", "适用于特定考试会话的配置"),

    /** 用户 */
    USER("USER", "用户", "适用于特定用户或用户组的配置"),

    /** 任务 */
    TASK("TASK", "任务", "适用于特定监控任务的配置"),

    /** 组织 */
    ORGANIZATION("ORGANIZATION", "组织", "适用于特定组织单位的配置"),

    /** 系统 */
    SYSTEM("SYSTEM", "系统", "适用于系统级服务和组件的配置");

    private final String code;
    private final String description;
    private final String detail;

    MonitoringConfigScope(String code, String description, String detail) {
        this.code = code;
        this.description = description;
        this.detail = detail;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public String getDetail() {
        return detail;
    }

    public static MonitoringConfigScope fromCode(String code) {
        for (MonitoringConfigScope scope : values()) {
            if (scope.getCode().equals(code)) {
                return scope;
            }
        }
        throw new IllegalArgumentException("Unknown monitoring config scope code: " + code);
    }

    @Override
    public String toString() {
        return this.code + "(" + this.description + ")";
    }
}
